package emqhook

import (
	"encoding/json"
	"fmt"
	"github.com/gin-gonic/gin"
	"github.com/lexkong/log"
	"net/http"
)


func Monitor(c *gin.Context) {
	log.Info("User Create function device.")
	var r CreateRequest

	buf := make([]byte,512)
	 n,_:=c.Request.Body.Read(buf)

	err:=json.Unmarshal(buf[0:n],&r)
	if err !=nil {
		fmt.Println(err)
	}
	fmt.Println("解析前消息:",string(buf))

	fmt.Println("json格式化后:",r)
	c.String(http.StatusOK, "Hello %s", "world")
}
